#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'tian'
__data__ = '2021/12/6 17:34'
# software: PyCharm

from django.utils.deprecation import MiddlewareMixin

from apps.app01 import models


class Tracer:
    def __init__(self):
        self.project = None


class ItemsMiddleware(MiddlewareMixin):

    def process_request(self, request):
        request.tracer = Tracer()
        # 所有项目
        all_project = models.It.objects.all()
        request.tracer.project = all_project
